python bindings#948
Conversation
…or a batch to improve ease-of-use.
52f1d6f to
b1eedce
Compare
…n-dev into feature/python-bindings
…mt/marian-dev into feature/python-bindings
| include_directories(3rd_party) | ||
| include_directories(3rd_party/SQLiteCpp/include) | ||
| include_directories(3rd_party/sentencepiece) | ||
| # include_directories(3rd_party/sentencepiece) |
There was a problem hiding this comment.
Is this meant to be commented out? I am not sure why spm_encode isn't found in CI on OS X, but I suspect this is the culprit.
There was a problem hiding this comment.
I don't think so. I've updated GitHub workflows recently, which may fix issues on macOS. I will rebase this branch with the current master and re-run builds.
There was a problem hiding this comment.
Thanks, @snukky! It still seems like there's something fishy happening on the spm front...
3d8c64b to
08c4ef0
Compare
|
Is this still WIP as the title suggests or is it ready for reviews as it's not marked as a draft? |
|
This is ready for review. There are some conflicts, but I won't be able to address them until early next week. The CI failure seems to be related to disk on the OS X build. We'll need to follow a similar recipe as Windows to clear intermediate build directories and this should be OK. |
|
It seems like the OS X error here is due to 3pp zstr here. I'm not sure why OS X is falling into this branch since L30 should cover the OS X case... Is there a missing cmake flag somewhere? |
snukky
left a comment
There was a problem hiding this comment.
Many thanks Elijah for this PR again. As it was forever since this PR was open, I'm happy to take over, rebase with the current master and introduce the changes I'm proposing. I had mostly comments on improving documentation of the code.
I think other remaining tasks related to this code would be 1) fixing MacOS compilation, and 2) adding some regression tests on actual models, but we can take care of them in separate PRs.
Thanks!
| ./marian --version | ||
| ./marian-decoder --version | ||
| ./marian-scorer --version | ||
| ./spm_encode --version |
There was a problem hiding this comment.
What was the motivation for this to get removed?
| -DCOMPILE_CPU=${{ matrix.cpu }} \ | ||
| -DCOMPILE_CUDA=${{ matrix.gpu }} \ | ||
| -DCOMPILE_EXAMPLES=${{ matrix.examples }} \ | ||
| -DUSE_TCMALLOC=OFF \ |
There was a problem hiding this comment.
Python bindings doesn't work with TCMalloc? Why? Would be great to have it fixed or at least commented/documented.
| ./marian-scorer --version | ||
| ./marian-server --version | ||
| ./spm_encode --version |
There was a problem hiding this comment.
As above, why do we need to remove these checks?
| cd .. | ||
| rd /s /q build |
There was a problem hiding this comment.
Is this for debugging? I would suggest adding a short comment above explaining what it does and why it is done.
| @@ -1,4 +1,3 @@ | |||
| # Config files from CMake | |||
There was a problem hiding this comment.
I think this comment is still valid, isn't it?
| @@ -0,0 +1,27 @@ | |||
| import sys | |||
There was a problem hiding this comment.
Consider adding a short comment at the top of this file what this script does and a usage example.
| public: | ||
| virtual ~TranslateService() {} | ||
|
|
||
| TranslateService(const std::string& cliString) |
There was a problem hiding this comment.
Nit: consider adding a short docstring explaining what it is used for.
| @@ -0,0 +1,27 @@ | |||
| import sys | |||
There was a problem hiding this comment.
Is any of those files used for regression tests? Could it easily be?
| } | ||
|
|
||
| std::string run(const std::string& input) override { | ||
| std::vector<std::string> run(const std::vector<std::string>& inputs, const std::string& yamlOverridesStr="") override { |
There was a problem hiding this comment.
I think the second parameter deserves a short description in a docstring.
| return utils::split(translations, "\n", /*keepEmpty=*/true); | ||
| } | ||
|
|
||
| std::string run(const std::string& input, const std::string& yamlOverridesStr="") override { |
There was a problem hiding this comment.
I think this function also could receive a docstring.
…n-dev into feature/python-bindings
|
Oh, and @thammegowda of course |
|
A first thing that I see is that this should use the python package of SentencePiece from src/3rdparty |
Description
Adds python bindings using pybind11 for high-level bindings.
Added dependencies: pybind11
How to test
Checklist